<template>
  <div>
    <div class="WaterTable">
      <el-table
        style="width: 100%"
        border
        :data="list"
        text-align="center"
        :header-cell-style="{ 'text-align': 'center' }"
        :cell-style="{ 'text-align': 'center' }"
        size="small"
      >
        <el-table-column prop="monitorCode" label="测点编号"> </el-table-column>
        <el-table-column prop="monitorName" label="测点名称"></el-table-column>
        <el-table-column prop="data" label=" 库水位标高(m)"></el-table-column>
        <el-table-column prop="heightDiff" label="高差(m)"></el-table-column>
        <el-table-column prop="limitValue" label="限值(m)"></el-table-column>
        <el-table-column prop="theDate" label="测量时间"></el-table-column>
      </el-table>
    </div>
    <!-- <div id="beachCharts" class="beach"></div> -->
  </div>
</template>
<script>
import { getLatestLevelData } from '../../../api/Monitoring';
export default {
  name: 'Water',
  components: {},
  props: {
    node: Object
  },
  data () {
    return {
      list: [],
    }
  },
  methods: {
    async getList() {
      console.log(this.node.monitorCode)
      const res = await getLatestLevelData({
        monitorCode: this.node.monitorCode,
        count: 17,
      });
      console.log(res);
      if (res.resultCode == "200") {
        this.list = res.parameter;
        console.log(this.list);
        this.list.forEach((item) => {
          item.data = item.data.toFixed(2);
        });

        // this.list.unshift({
        //   data:list.data,
        //   monitorCode:list.monitorCode,
        //   monitorName:list.monitorName,
        //   theDate:list.theDate
        // })
        //   this.newObj.length > 17 ? this.newObj.splice(17, 1) : null
      } else if (res.resultCode == "204") {
        this.list = [];
        this.$message.info("暂无数据");
      }
    },
  },
  created () {
    this.getList()
  },
};
</script>

<style scoped>
.beach {
  /* width: 1000px; */
  height: 40vh;
  margin-top: 10px;
  /* margin: 0 auto; */
}
.WaterTable {
  height: 82vh;
  overflow: auto;
}
.WaterTable >>> .el-table tr:nth-child(odd) {
  /* background: pink; */
  text-align: center !important;
  color: #000;
  font-size: 12px;
}
.WaterTable >>> .el-table tr:nth-child(even) {
 background: rgba(0, 0, 0, 0.05);
  text-align: center !important;
  color: #000;
  font-size: 12px;
}
</style>